Effect of 'myObj = [[[[MyClass alloc] init] autorelease] retain];'?

Posted by filipe on Stack Overflow See other posts from Stack Overflow or by filipe
Published on 2010-08-31T20:03:42Z Indexed on 2012/06/25 3:16 UTC
Read the original article Hit count: 229

I've just downloaded the Facebook iOS SDK and I noticed that in the sample code that comes with the SDK whenever it creates an instance of the Facebook class it does it like this:

_facebook = [[[[Facebook alloc] init] autorelease] retain];

where _facebook is a member variable of the calling object (i.e. not a local variable).

Can anyone explain exactly what's the point of autoreleasing and then retaining it?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c